<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }
      main {
        width: 1000px;
        background-color: lightcyan;
        margin: 0 auto;
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
      }

      div {
        width: 300px;
        height: 200px;
        background-color: lightcoral;
        margin-bottom: 40px;
      }

      @media all and (max-width: 1100px) and (min-width: 760px) {
        main {
          width: 600px;
        }
        div {
          width: 270px;
        }
      }

      @media all and (max-width: 760px) {
        main {
          width: 80%;
        }
        div {
          width: 100%;
        }
      }
    </style>
  </head>
  <body>
    <main>
      <div>1</div>
      <div>2</div>
      <div>3</div>
      <div>4</div>
      <div>5</div>
      <div>6</div>
      <div>7</div>
      <div>8</div>
      <div>9</div>
      <div>10</div>
      <div>11</div>
      <div>12</div>
      <div>13</div>
      <div>14</div>
      <div>15</div>
      <div>16</div>
      <div>17</div>
      <div>18</div>
    </main>
  </body>
</html>

<!-- 
  当屏幕宽度大于1100px的时候，有一个1000px宽的版心，同时一行显示3个商品

  当屏幕宽度小于1100px，大于760px的时候，有一个600px的版心，同时一行显示2个商品

  当屏幕宽度小于760px，一行只显示一个商品
 -->
